<?
if ($this->group->GetId())
    $title = 'Редактирование группы';
else
    $title = 'Добавление группы';
?>
<h1><?=$title;?></h1>
<form
	action="<?=MozgRoute::Get('http')->Create(array('module' => 'admin', 'ctrl' => 'groups', 'action' => 'save_group'));?>"
	method="post" name="form1">
<table onmouseover="this.style.background = '#eaeaea'"
	onmouseout="this.style.background = '#fff'" align="center">
	<tr>
		<td class="field-title"><label>Владелец группы</label></td>
		<td class="field-place"><select name="parent_id">
<?
while (list (, $id) = each($this->parentGroups)) 
{
	$group = $this->mapper->GetById($id);
	if (!$group) continue;
    $s .= '<option value="' . $id . '"' . ($this->group->GetParentId() == $id ? ' selected' : '') . '>' . $group->GetTitle() . '</option>';
}
echo $s;
?>
      	</select></td>
	</tr>
	<tr>
		<td class="field-title"><label>Название</label></td>
		<td class="field-place"><input type="text" name="title"
			value="<?=htmlspecialchars($this->group->GetTitle());?>"></td>
	</tr>
</table>
<table>
	<tr>
		<td class="r"><input type="submit" value="Сохранить" class="bt" /></td>
		<td class="l"><input type="button" value="Назад" class="bt"
			onClick="window.location.href='<?=MozgRoute::Get('http')->Create(array('module' => 'admin', 'ctrl' => 'groups'));?>';" /></td>
	</tr>
</table>
<input type="hidden" name="id" value="<?=$this->group->GetId();?>"></form>